<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Siêu thị mua bán Điện thoại di động - Laptop - Phụ kiện - Khách hàng</title>

     <!-- Bootstrap Core CSS -->
    <link href="../../../css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="../../../css/sb-admin.css" rel="stylesheet">

    <!-- Morris Charts CSS -->
    <link href="../../../css/plugins/morris.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="../../../font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="../index.php">Quản lý cửa hàng</a>
				
            </div>
            <!-- Top Menu Items -->
            <ul class="nav navbar-right top-nav">
				                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-envelope"></i> <b class="caret"></b></a>
                    <ul class="dropdown-menu message-dropdown">
					
                        <li class="message-preview">
                            <a href="#">
                                <div class="media">
                                    <span class="pull-left">
                                        <img class="media-object" src="http://placehold.it/50x50" alt="">
                                    </span>
                                    <div class="media-body">
                                        <h5 class="media-heading"><strong>John Smith</strong>
                                        </h5>
                                        <p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
                                        <p>Lorem ipsum dolor sit amet, consectetur...</p>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="message-preview">
                            <a href="#">
                                <div class="media">
                                    <span class="pull-left">
                                        <img class="media-object" src="http://placehold.it/50x50" alt="">
                                    </span>
                                    <div class="media-body">
                                        <h5 class="media-heading"><strong>John Smith</strong>
                                        </h5>
                                        <p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
                                        <p>Lorem ipsum dolor sit amet, consectetur...</p>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="message-preview">
                            <a href="#">
                                <div class="media">
                                    <span class="pull-left">
                                        <img class="media-object" src="http://placehold.it/50x50" alt="">
                                    </span>
                                    <div class="media-body">
                                        <h5 class="media-heading"><strong>John Smith</strong>
                                        </h5>
                                        <p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
                                        <p>Lorem ipsum dolor sit amet, consectetur...</p>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="message-footer">
                            <a href="#">Read All New Messages</a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bell"></i> <b class="caret"></b></a>
                    <ul class="dropdown-menu alert-dropdown">
                        <li>
                            <a href="#">Alert Name <span class="label label-default">Alert Badge</span></a>
                        </li>
                        <li>
                            <a href="#">Alert Name <span class="label label-primary">Alert Badge</span></a>
                        </li>
                        <li>
                            <a href="#">Alert Name <span class="label label-success">Alert Badge</span></a>
                        </li>
                        <li>
                            <a href="#">Alert Name <span class="label label-info">Alert Badge</span></a>
                        </li>
                        <li>
                            <a href="#">Alert Name <span class="label label-warning">Alert Badge</span></a>
                        </li>
                        <li>
                            <a href="#">Alert Name <span class="label label-danger">Alert Badge</span></a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">View All</a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> John Smith <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="#"><i class="fa fa-fw fa-user"></i> Profile</a>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-fw fa-envelope"></i> Inbox</a>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-fw fa-gear"></i> Settings</a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#"><i class="fa fa-fw fa-power-off"></i> Log Out</a>
                        </li>
                    </ul>
                </li>
            </ul>
            <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
            <div class="collapse navbar-collapse navbar-ex1-collapse">
                <ul class="nav navbar-nav side-nav">
					
                    <li class="active">
                        <a href="../index.php"><i class="fa fa-fw fa-dashboard"></i>Trang chủ</a>
                    </li>
                     <li>
                        <a href="javascript:;" data-toggle="collapse" data-target="#demo"><i class="fa fa-fw fa-pied-piper"></i>Sản phẩm<i class="fa fa-fw fa-caret-down"></i></a>
                        <ul id="demo" class="collapse">
                           
                                <li>
                                    <a href="#"><i class="fa fa-mobile-phone fa-fw"></i> Điện thoại</a>
                                </li>
								<li>
                                    <a href="#"><i class="fa fa-laptop fa-fw"></i> Lap Top</a>
                                </li>
								<li>
                                    <a href="#"><i class="fa fa-gears fa-fw"></i> Phụ kiện</a>
                                </li>
                        </ul>
                    </li>
                    <li>
                        <a href="javascript:;" data-toggle="collapse" data-target="#loaisp"><i class="fa fa-fw fa-table"></i>Loại sản phẩm<i class="fa fa-fw fa-caret-down"></i></a>
						<ul id="loaisp" class="collapse">
						<li>
                                    <a href="../morris.html"><i class="fa fa-mobile-phone fa-fw"></i> Điện thoại</a>
                                </li>
								<li>
                                    <a href="../morris.html"><i class="fa fa-laptop fa-fw"></i> Lap Top</a>
                                </li>
								<li>
                                    <a href="../morris.html"><i class="fa fa-gears fa-fw"></i> Phụ kiện</a>
                                </li>
								</ul>
                    </li>
                    <li>
                        <a href="javascript:;" data-toggle="collapse" data-target="#dondathang"><i class="fa fa-fw fa-shopping-cart"></i>Đơn đặt hàng<i class="fa fa-fw fa-caret-down"></i></a>
						<ul id="dondathang" class="collapse">
                                <li>
                                    <a href="../flot.html"><i class="fa f fa-th fa-fw"></i> Xem tất cả đơn đặt hàng</a>
                                </li>
                                
                            </ul>
                    </li>
                    <li>
                        <a href="javascript:;" data-toggle="collapse" data-target="#nhasx"><i class="fa fa-fw fa-home"></i>Nhà sản xuất<i class="fa fa-fw fa-caret-down"></i></a>
						<ul id="nhasx" class="collapse">
                                <li>
                                    <a href="../flot.html"><i class="fa f fa-th fa-fw"></i> Xem tất cả NSX</a>
                                </li>
                                
                            </ul>
                    </li>
                     <li>
                        <a href="javascript:;" data-toggle="collapse" data-target="#gia"><i class="fa fa-fw fa- fa-dollar"></i>Giá sản phẩm<i class="fa fa-fw fa-caret-down"></i></a>
                        <ul id="gia" class="collapse">
                           <li>
                                    <a href='../index.php'"><i class="fa fa-table fa-fw"></i> Xem tất cả các giá</a>
                                </li>
                               
                        </ul>
                    </li>
                    <li>
                        <a href="javascript:;" data-toggle="collapse" data-target="#thanhvien"><i class="fa fa-fw fa-users"></i>Thành viên<i class="fa fa-fw fa-caret-down"></i></a>
                        <ul id="thanhvien" class="collapse">
                           <li>
                                    <a href="#"><i class="fa fa-gear fa-fw"></i> Quản trị</a>
                                </li>
                                <li>
                                    <a href="#"><i class="fa fa-user fa-fw"></i> Người dùng</a>
                                </li>
                        </ul>
                    </li>
                    
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </nav>

        <div id="page-wrapper">

            <div class="container-fluid">
				 <div class="row">
					<div class="col-lg-6">
						<div class="input-group">						
							<input type="hidden" name="search_param" value="all" id="search_param">         
							<input type="text" class="form-control" name="x" placeholder="Tìm kiếm">
							<span class="input-group-btn">
							<button class="btn btn-info" type="button"><span class="glyphicon glyphicon-search"></span></button>
							</span>
							
						
							
						
					</div>
				</div>
                <!-- Page Heading -->
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header">
                            <i class="fa fa-fw fa-dashboard"></i>Trang chủ <small>Xinh chào admin !</small>
                        </h1>
                        <ol class="breadcrumb">
                            <li>
                             <a href="../../index.html"<i class="fa fa-dashboard"></i> Trang chủ</a>
                            </li>
							<li class="active">
                                <i class="fa fa-user"></i> Khách hàng
                            </li>
                        </ol>
                    </div>
                </div>
                <!-- /.row -->

                <div class="row">
				
                    <div class="col-lg-8">
                        <div class="alert alert-info alert-dismissable">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                            <label class="text-info"><i class=" fa fa-fw  fa-list-alt"></i> Điều khoản sử dụng</label><br/>
							<i class=" fa fa-fw fa-hand-o-right"></i> Admin có thể cập nhật thông tin khách hàng.<br/>
						
                        </div>
                    </div>
                </div>              <!-- /.row -->
                              
                <!-- /.row -->
				<div class="row">
                    <div class="col-lg-10">
					<h5><a href="../themgiasp.html" ><i class=" glyphicon glyphicon-plus"></i> Thêm khách hàng</a></h5>
                        <div class="panel panel-primary">
                            <div class="panel-heading">
                                <h3 class="panel-title"><i class="fa fa-user fa-fw"></i>Tất cả khách hàng</h3>
                            </div>
                            <div class="panel-body">
                               
							   <table class ="table table-bordered text-center ">
								<tr>
								<th>ID</th>
								<th>Tên khách hàng</th>
								<th>Số điện thoại</th>
								<th>Địa chỉ</th>
                                <th>Tài khoản</th>							
								</tr>
								<?php
								function adddotstring($strNum) {
 
       								 $len = strlen($strNum);
        								$counter = 3;
       										 $result = "";
       									 while ($len - $counter >= 0)
       							 {
          						  $con = substr($strNum, $len - $counter , 3);
           							 $result = '.'.$con.$result;
            				$counter+= 3;
       							 }
        				$con = substr($strNum, 0 , 3 - ($counter - $len) );
        					$result = $con.$result;
       					 if(substr($result,0,1)==','){
           						 $result=substr($result,1,$len+1);   
       						 }
        					return $result;
									}
								require_once "../../../config.php";
								$sql = "SELECT
									khach_hang.ID,
									khach_hang.TEN_KH,
									khach_hang.SDT,
									khach_hang.DIA_CHI,
									khach_hang.TAI_KHOAN
									FROM
									khach_hang
									";
									
								$result= mysql_query($sql);
								if (mysql_num_rows($result) > 0) {									
								while($row = mysql_fetch_assoc($result)){
									$ma=$row['ID'];	
									$formatsdt = 	adddotstring($row['SDT'])	;																							
									echo "<tr>";
									echo "<td>" . $row['ID'] . "</td>";	
									echo "<td>" . $row['TEN_KH'] . "</td>";
									echo "<td>" . $formatsdt . "</td>";	
									echo "<td>" . $row['DIA_CHI'] . "</td>";
									echo "<td>" . $row['TAI_KHOAN'] . "</td>";																	
									echo "<td>";																
									echo "<a class='btn btn-info' href='' ><i class=' fa fa-fw fa-edit'></i> Sửa</a>";
									echo "</td>";
									echo "<td>";									
									echo "<a onClick=\"return confirm('Bạn có muốn xóa?')\" class='btn btn-danger' 																		                                    href='' ><i class=' glyphicon glyphicon-trash'> </i> Xóa</a>";
									echo "</td>";
									echo "</tr>";
									
							 }
								}
								 else {
    									echo "<p class='text-danger'>Không có kết quả nào<p>";
}
								?>
								
							</table>
							
                            </div>
                        </div>
                    </div>
                </div>
				
				
				
           

            </div>
            <!-- /.container-fluid -->

        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->



    <!-- jQuery -->
     
    <script src="../../../js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="../../../js/bootstrap.min.js"></script>

    <!-- Morris Charts JavaScript -->
    <script src="../../../js/plugins/morris/raphael.min.js"></script>
    <script src="../../../js/plugins/morris/morris.min.js"></script>
    <script src="../../../js/plugins/morris/morris-data.js"></script>


</body>

</html>
